<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>UCenter</title>

    <!-- Bootstrap core CSS -->
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="{{ url_for('static', filename='css/ie10-viewport-bug-workaround.css') }}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="{{ url_for('static', filename='css/dashboard.css') }}" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="{{ url_for('static', filename='js/ie-emulation-modes-warning.js') }}"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="javascript:void(0)">宇宙中心财务处</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            {% if not user%}<li><a href="{{url_for('usercontroller.login')}}">登陆</a></li>{% endif %}
            {% if user%}<li><a href="{{url_for('first')}}">{{user.uname}}</a></li>{% endif %}
            <li><a href="javascript:void(0)">帮助</a></li>
          </ul>
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="active"><a href={{url_for('first')}}>列表 <span class="sr-only">(current)</span></a></li>
            <li><a href="{{url_for('ordercontroller.history')}}">历史</a></li>
            {% if user %}
            <li><a href={{url_for('ordercontroller.add')}}>添加</a></li>
            <li><a href={{url_for('usercontroller.out_html')}}>登出</a></li>
            {% endif %}
          </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">今日账单</h1>
          {% for message in get_flashed_messages() %} 
          <div class="alert alert-warning"><button type="button" class="close" data-dismiss="alert">&times;</button> 
          {{ message }} </div> 
          {% endfor %}
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>编号</th>
                  <th>类目</th>
                  <th>花费</th>
                  <th>附件</th>
                  <th>时间</th>
                  <th>姓名</th>
                  <th>状态</th>
                  {% if user%}<th>操作</th>{% endif %}
                </tr>
              </thead>
              <tbody>
              {% for order in orderList%}
                <tr>
                  <td>{{ order.id }}</td>
                  <td>{{ order.item }}</td>
                  <td>{{ order.amount }}</td>
                  <td>{% if order.attach %}{{ order.attach }}{% endif %}{% if not order.attach %}无{% endif %}</td>
                  <td>{{ order.shop_time }}</td>
                  <td>{{ order.name }}</td>
                  {% if order.audit_state == 0 %}
                  <td>待报销</td>
                  {% if user%}<td><a href={{url_for('ordercontroller.accept', id=order.id, s='1', w='')}}>报销</a></td>{% endif %}
                  {% endif %}
                  {% if order.audit_state == 1 %}
                  <td>已报销</td>
                  {% if user%}<td><a href={{url_for('ordercontroller.accept', id=order.id, s='0', w='')}}>撤回</a></td>{% endif %}
                  {% endif %}
                </tr>
              {% endfor %}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="{{ url_for('static', filename='js/holder.min.js') }}"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{{ url_for('static', filename='js/ie10-viewport-bug-workaround.js') }}"></script>
  </body>
</html>
